		TITLE	FUZZINST - Copyright (C) 1994 SLR Systems

		INCLUDE	MACROS
		INCLUDE	SYMBOLS

		PUBLIC	UNDECO_INSTALL


		.DATA

		EXTERNDEF	SYMBOL_TEXT:BYTE,EXETYPE_FLAG:BYTE,FLOAT_FLAG:BYTE,FLOAT_TYPE:BYTE,COMDAT_FLAGS:BYTE

		EXTERNDEF	UNDECO_HASH:DWORD,SYMBOL_LENGTH:DWORD,SYMBOL_HASH:DWORD,UNDECO_HASH_PHYS:DWORD

		EXTERNDEF	SYMBOL_GARRAY:STD_PTR_S,LNAME_LARRAY:LARRAY_STRUCT

		EXTERNDEF	CASE_STRING_COMPARE:DWORD


		.CODE	PASS1_TEXT

UNDECO_INSTALL	PROC
		;
		;EDX IS HASH VALUE, CONVERT IT
		;
		;RETURN EAX IS LOGICAL, ECX IS PHYS
		;
		PUSH	EBX
		MOV	EAX,EDX

		XOR	EDX,EDX
		MOV	EBX,UNDECO_HASH_PHYS

		HASHDIV	UNDECO_HASH		;EDX IS HASH VALUE

		PUSHM	EDI,ESI
FAR_CONT:
		MOV	EAX,[EBX+EDX*4]
		LEA	EBX,[EBX+EDX*4 - SYMBOL_STRUCT._S_NEXT_HASH_GINDEX]
FAR_NEXT:
		TEST	EAX,EAX
		JZ	DO_FAR_INSTALL

		CONVERT	EBX,EAX,SYMBOL_GARRAY
		ASSUME	EBX:PTR SYMBOL_STRUCT
		;
		;PROBABLE MATCH, NEED COMPARE...
		;
		MOV	EDX,EAX

		MOV	ECX,SYMBOL_LENGTH
		MOV	EDI,OFF SYMBOL_TEXT

		LEA	ESI,[EBX]._S_NAME_TEXT
		;
		;IF CASE IS SIGNIFICANT, OR ALL UPPER, OR ALL LOWER
		;USE THIS ROUTINE.  IF IGNORE CASE BUT PRESERVE...
		;
		CALL	CASE_STRING_COMPARE

		MOV	EAX,[EBX]._S_NEXT_HASH_GINDEX
FAR_NEXT_1:
		JNZ	FAR_NEXT
FAR_MATCH:
		POPM	ESI,EDI

		MOV	ECX,EBX
		POP	EBX

		MOV	EAX,EDX
		CMP	ESP,-1			;EAX IS GINDEX, ECX IS PHYS

		RET

UNDECO_INSTALL	ENDP


DO_FAR_INSTALL	PROC	PRIVATE
		;
		;DS:BX GETS POINTER...
		;
		MOV	EAX,SYMBOL_LENGTH

		ADD	EAX,SIZE SYMBOL_STRUCT-3
		SSYM_POOL_ALLOC			;ES:DI IS PHYS, AX LOG

		MOV	EDI,EAX
		INSTALL_POINTER_GINDEX	SYMBOL_GARRAY
		MOV	[EBX]._S_NEXT_HASH_GINDEX,EAX

		MOV	ESI,OFF SYMBOL_TEXT
		PUSH	EAX

		XOR	EAX,EAX
		MOV	ECX,SYMBOL_STRUCT._S_NAME_TEXT/4

		MOV	EDX,[ESI-4]
		MOV	EBX,EDI

		SHR	EDX,2

		OPTI_STOSD

		LEA	ECX,[EDX+1]
		POP	EAX

		REP	MOVSD

		POP	ESI
		POPM	EDI

		MOV	ECX,EBX
		POP	EBX

		OR	ECX,ECX

		RET				;DS:BX IS PHYS, AX IS GINDEX

DO_FAR_INSTALL	ENDP


		END

